<?php
namespace yan\hkecship\factory;
class RegionList extends Client{
	public $path = '/version/1/common/countryList/get';
    public function run($data=[]){
        $path = dirname(__DIR__) . '/countrylist.json';
        if(file_exists($path)){
            $data = file_get_contents($path);
            return json_decode($data, true);
        }

        $headers[] = $this->environment->getAuthorization();
        $body = $this->curl->build($this->getUrl())
            ->setHeader($headers)
            ->run();
        return json_decode($body, true);
    }
    public function getUrl(){
        return $this->environment->baseUrl() . $this->path;
    }
}